<template>
  <div>
    <div>
      <van-nav-bar :title="deatilText.title" left-text="返回" left-arrow @click-left="onClickLeft" />
    </div>
    <div style="overflow: hidden;">
      <div class="pageTitle">
        <span>
          {{deatilText.title}}
        </span>
      </div>
      <div class="pagetime"><span>{{deatilText.updateTime}}</span></div>
      <div class="pageContent" v-for="(item,index) in wordText" :key="index">
        {{item}}
      </div>
      <div style="text-align: center;margin:5px 0 15px 0;" v-for="(item,index) in imgList" :key="index">
        <van-image width="20rem" height="10rem" fit="cover" :src="item.url" />
      </div>
    </div>
    <div class="footer">
      <div class="aboutme">
      </div>
      <van-divider />
      <div class="last">
        <a href="http://www.beian.miit.gov.cn">
          备案号：苏ICP备20041612号
        </a>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'PhoneDeatil',
  data () {
    return {
      imgList: [],
      deatilText: {},
      wordText: []
    }
  },
  methods: {
    onClickLeft () {
      window.history.back(-1)
    },
    getquery () {
      this.name = this.$route.query.name
      this.id = this.$route.query.id
      if (this.name === 'Case') {
        this.$axios({
          method: 'get',
          url: '/success/get?id=' + this.id
        }).then((res) => {
          this.deatilText = res.data.data
          var content = decodeURI(res.data.data.content)
          this.wordText = content.split('<span>')
          this.imgList = res.data.data.successtList
        })
      } else if (this.name === 'News') {
        this.$axios({
          method: 'get',
          url: '/news/get?id=' + this.id
        }).then((res) => {
          this.deatilText = res.data.data
          var content = decodeURI(res.data.data.content)
          this.wordText = content.split('<span>')
          this.imgList = res.data.data.successtList
        })
      } else if (this.name === 'Notice') {
        this.$axios({
          method: 'get',
          url: '/notice/get?id=' + this.id
        }).then((res) => {
          this.deatilText = res.data.data
          var content = decodeURI(res.data.data.content)
          this.wordText = content.split('<span>')
          this.imgList = res.data.data.successtList
        })
      }
    }
  },
  mounted () {
    this.getquery()
  },
  activated () {
    this.getquery()
  }
}
</script>

<style scoped>
.pageTitle {
  margin: 15px 5px 0 5px;
  font-size: 25px;
  font-weight: 500;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  line-height: 35px;
}
.pageContent {
  margin: 0 4px 15px 8px;
  text-indent: 2rem;
  white-space: normal;
  line-height: 1.8;
  font-size: 18px;
  font-family: "Microsoft YaHei", Arial, sans-serif;
}
.pagetime {
  font-size: 14px;
  line-height: 1.8;
  color: #999;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  text-align: center;
}
.footer {
  text-align: center;
  background: #364a62;
  overflow: hidden;
  margin-top: 15px;
}
.aboutme {
  margin-top: 10px;
  color: white;
  font-weight: 600;
}
.content {
  margin-top: 10px;
  text-align: center;
  font-weight: normal;
}
.last {
  height: 20px;
  line-height: 20px;
  color: white;
  margin-bottom: 16px;
}
a {
  text-decoration: none;
  color: white;
}
</style>
